
import sys, random

def generate_random_cluster_centroids(num_clusters, dimension):
	cluster_centroids = []
	for i in range(num_clusters):
		cluster_centroids.append([])
		for j in range(dimension):
			cluster_centroids[i].append(random.randint(-1000, 1000))
	return cluster_centroids


def generate_random_points(num_points, num_clusters, intersection_level, dimension):
	cluster_centroids = generate_random_cluster_centroids(num_clusters, dimension)
	num_points_per_cluster = num_points / num_clusters

	radius = 1000 * intersection_level + 1
	sigma = radius / 2
	
	for i in range(num_clusters):
		for j in range(num_points_per_cluster):
			for k in range(dimension):
				print random.gauss(0, sigma) + cluster_centroids[i][k],
			print ""

if __name__ == "__main__":

	argv = sys.argv
	argc = len(argv)

	if (argc < 5):
		print ""
		print "Use python", argv[0], "<num points> <num clusters> <intersection-level:[0-1]> <dim>"
		print ""
	else:
		num_points = int(argv[1])
		num_clusters = int(argv[2])
		intersection_level = float(argv[3])
		dimension = int (argv[4])
		generate_random_points(num_points, num_clusters, intersection_level, dimension)
	
